﻿@model Aga.GestionDeArchivos.Web.Models.Users.RolesModel
@{
    ViewBag.Title = "Editar Roles de Usuario";
    Layout = "~/Views/Shared/_InternalLayout.cshtml";
}
<div id="content">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="box-style1">
        <tr>
            <td id="box2">
                <h2>
                    Editar Roles de <span>@Model.User.FullName</span></h2>
                <table class="abm">
                    <tr>
                        <th>
                            Rol
                        </th>
                        <th>
                            Descripción
                        </th>
                        <th>
                        </th>
                    </tr>
                    @if (Model.AllRoles.Count() > 0)
                    {
                        foreach (var item in Model.AllRoles)
                        {
                        <tr class="@(Model.UsersRoles.Any(r => r.Id == item.Id) ? "highlighted" : "" )">
                            <td>@item.Name
                            </td>
                            <td>@item.Description
                            </td>
                            <td>
                                @if (Model.UsersRoles.Any(r => r.Id == item.Id))
                                {
                                    @Html.ActionLink("Quitar", "RemoveRole", new { id = Model.User.Id, roleId = item.Id })
                                }
                                else
                                {
                                    @Html.ActionLink("Agregar", "AddRole", new { id = Model.User.Id, roleId = item.Id })
                                }
                            </td>
                        </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="6">
                                No hay datos para mostrar
                            </td>
                        </tr>
                    }
                </table>
                <p class="buttons alignleft">
                    @Html.ActionLink("Volver", "Index")
                </p>
            </td>
        </tr>
    </table>
</div>
